package com.example.makerspace.controller.organize;

import com.example.makerspace.dto.Result;
import com.example.makerspace.dto.organizeDTO.OrganizeDTO;
import com.example.makerspace.service.AdminService;
import com.example.makerspace.service.OrganizeService;
import com.example.makerspace.vo.CooperationVO;
import com.example.makerspace.vo.OrganizationProjectVO;
import com.example.makerspace.vo.OrganizationVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@Controller
@ResponseBody
@RequestMapping("/api/organize")
@Api(tags = "组织模块")
public class OrganizeController {
    @Resource
    private OrganizeService organizeService;

    private  final  static  String   testHttpPrefix="https://119.45.199.13:3035/static/";
    private  final  static  String  devHttpPrefix="https://nism.ytcata.com:443/static/";

    @ApiOperation(value = "创建组织", notes = "展示项目列表")
    @PostMapping("/createOrganize")
    public Result createOrganize(@RequestBody OrganizeDTO organizeDTO) {
        return organizeService.createOrganize(organizeDTO);
    }

    @ApiOperation(value = "更新组织设置", notes = "展示项目列表")
    @PostMapping("/updateOrganize")
    public Result updateOrganize(@ModelAttribute OrganizeDTO organizeDTO) {
        return organizeService.updateOrganize(organizeDTO);
    }

    @ApiOperation(value = "添加组织成员", notes = "展示项目列表")
    @PostMapping("/addOrganizePeople")
    public Result addOrganizePeople(@RequestBody OrganizationVO organizationVO) {
        return organizeService.addOrganizePeople(organizationVO);
    }
    @ApiOperation(value = "删除组织成员", notes = "展示项目列表")
    @PostMapping("/delOrganizePeople")
    public Result delOrganizePeople(@RequestBody OrganizationVO organizationVO) {
        return organizeService.delOrganizePeople(organizationVO);
    }

    @ApiOperation(value = "在组织下新建项目", notes = "展示项目列表")
    @PostMapping("/createOrganizeProject")
    public Result createOrganizeProject(@RequestBody OrganizationProjectVO organizationProjectVO) {
        return organizeService.createOrganizeProject(organizationProjectVO);
    }

    @ApiOperation(value = "展示用户下所有的组织信息列表", notes = "展示用户下的组织信息列表")
    @GetMapping("/showUserOrganizes")
    public Result showUserOrganizes(HttpServletRequest request) {
        return organizeService.showUserOrganizes(request);
    }

    @ApiOperation(value = "展示用户某个组织下的所有项目", notes = "展示用户下的组织信息列表")
    @GetMapping("/showUserOrganizeProject")
    public Result showUserOrganizeProject(@RequestParam("organizeId") Integer organizeId) {
        return organizeService.showUserOrganizeProject(organizeId);
    }



    @ApiOperation(value = "展示用户某个组织下的成员列表", notes = "展示项目列表")
    @GetMapping("/showUserOrganizesPen")
    public Result showUserOrganizesPen(HttpServletRequest request,@RequestParam("organizeId") Integer organizeId) {
        return organizeService.showUserOrganizesPen(request,organizeId);
    }
}
